package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppCreditModelConfig;
import com.ep.modules.app.service.AppCreditModelConfigService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/credit_model_config")
public class AppCreditModelConfigController {
    @Autowired
    private AppCreditModelConfigService appCreditModelConfigService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appCreditModelConfigService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppCreditModelConfig appcreditmodelconfig = appCreditModelConfigService.getById(id);
        return R.ok().put("appcreditmodelconfig", appcreditmodelconfig);
    }

    @SysLog("保存AppCreditModelConfig")
    @PostMapping("/save")
    public R save(@RequestBody AppCreditModelConfig appcreditmodelconfig) {
        ValidatorUtils.validateEntity(appcreditmodelconfig);
        appCreditModelConfigService.save(appcreditmodelconfig);
        return R.ok();
    }

    @SysLog("修改AppCreditModelConfig")
    @PostMapping("/update")
    public R update(@RequestBody AppCreditModelConfig appcreditmodelconfig) {
        ValidatorUtils.validateEntity(appcreditmodelconfig);
        appCreditModelConfigService.update(appcreditmodelconfig);
        return R.ok();
    }

    @SysLog("删除AppCreditModelConfig")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appCreditModelConfigService.deleteBatch(ids);
        return R.ok();
    }
}